<div class="jishi-title">
    <span class="game">北京赛车</span> > 下注明细
</div>

<table class="tr">
  <tr>
    <td width="80px">期号</td>
    <td>下注明细</td>
    <td width="70px">下注金额</td>
    <td width="70px">可赢金额</td>
  </tr>
</table>

<div class="scroll-data"><div class="for-scroll">
    <table>
        <tr>
            <td width="80px">期号</td>
            <td>下注明细</td>
            <td width="70px">下注金额</td>
            <td width="70px">输赢金额</td>
        </tr>
        <tr class="odd">
            <td width="120px">期号</td>
            <td>下注明细</td>
            <td width="70px">下注金额</td>
            <td width="70px">输赢金额</td>
        </tr>
    </table>
</div></div>

<div class="sum">
    <div class="win">总下注金额：<span>0</span></div>
    <div class="clear"></div>
</div>

<style type="text/css">
    .jishi-title {
        color: #fff;
        font-size: 0.6rem;
        line-height: 33px;
        padding-left: 10px;
    }
    .tr {
        width: 100%;
        height: 35px;
        color: #fff;
        font-size: 0.6rem;
    }
    .tr td {
        text-align: center;
        box-shadow: inset -1px 1px 0 0 rgba(255,255,255,.21), 1px 1px 0 0 rgba(0,0,0,.13);
        background-color: rgba(255,255,255,0.2);
    }
    .scroll-data table {
        width: 100%;
        font-size: 0.55rem;
        color: #fff;
    }
    .scroll-data table td {
        text-align: center;
        box-shadow: inset -1px 1px 0 0 rgba(255,255,255,.21), 1px 1px 0 0 rgba(0,0,0,.13);
        padding: 10px 1px 10px 1px;
    }
    .scroll-data {
        position: absolute;
        left: 0px;
        right: 0px;
        top: 69px;
        bottom: 45px;
        overflow: hidden;
    }
    .sum {
        position: absolute;
        left: 0px;
        right: 0px;
        bottom: 0px;
        height: 45px;
        color: #fff;
        font-size: 0.6rem;
        background-color: rgba(255,255,255,0.4);
        border-top: 1px solid #fff;
        line-height: 44px;
    }
    .sum .win {
        float: right;
        padding-right: 20px;
    }
    .sum span {
        font-weight: bold;
        color: green;
    }
</style>

<script>
    $("#center-top .home").hide();
    $("#center-top .back").show();
    $("#center-top .menu").hide();
    $(".game").html(get_game_display_name(urlInfo.params.g2));

    Lottery.cb = function() {
        var m = context.bets[urlInfo.params.g2];
        var table = $(".scroll-data table"); table.empty();
        if (Util.isEmpty(m)) {
            table.append('<tr><td colspan="4">暂无数据</td></tr>');
            return;
        }

        var total = 0;
        for (var issue in m) {
            var list = m[issue];
            var data = Lottery.combineGroup(list);
            for (var target in data) {
                var o = data[target];
                if (o.state != 0) continue;
                var target = o.target;
                if (o.group) {
                    var target = o.group.split("_")[0];
                }
                else
                    var target = Util.convertTarget(o.type, o.target);

                var tr = $("<tr></tr>");
                tr.append("<td width='80px'>" + issue + "</td>");
                tr.append("<td>" + target + "@" + o.rate + "</td>");
                tr.append("<td width='70px'>" + o.amount/100 + "</td>");
                total += o.amount;

                // 计算可赢金额
                var v = Math.round(o.amount * (o.rate - 1)) / 100;
                tr.append("<td width='70px'>" + v + "</td>");
                table.append(tr);
            }      
        }
        _mainScroll.refresh();
        table.find("td .blue").removeClass("blue");
        $(".sum .win span").html(total/100);
    };
    Lottery.refresh_uncheck();

    var _mainScroll;
    $(function() {
        _mainScroll = new IScroll(".scroll-data", {
            scrollX: false,
            scrollY: true,
            click: true,
        })
    });
</script>
